home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_c
/
lsdoor09.zip
/
LORDDEMO.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-03
|
4KB
|
108 lines
// LordDemo.Cpp - This example demonstrates how to use the LORD IGM features
// from the LsDoor SDK.
// * This example assumes some knowledge of the LsDoor SDK.
// * This example shows only SOME of the LORD IGM features. For a complete
// reference, refer to LORD.H.
// * Note that in the registered LsDoor SDK you must add LORD.CPP to your
// project before compiling this program.
#define MainModule
#include "LsDoor.h"
#include "Lord.h"
char *errorModule( void ){ return "LordDemo"; }
char demoExe[80];
void main( void )
{
char c;
LORD_Mail *mess;
strcpy( demoExe, _argv[0] );
// demoExe now holds the path & filename being run. Ex: C:\LordDemo.Exe
// You may want to change into your game's working directory at this
// point. When LORD runs your program, you will still be in the LORD
// directory, but because there is always the possibility the sysop will
// want to play in local mode, you should not assume that you are
// always in the LORD directory.
if( !LORD_Init( "." ) ){ // LORD_Init( path_to_lord );
display("\nThis demo must be in the same directory as LORD.\n");
exit(99);
}
while( online )
{
display("@{0}@g");
s_cls();
display(
"\nMenu..."
"\n"
"\n (1).. Try swearing"
"\n (2).. Send yourself mail"
"\n (I).. Install into LORD (Normally done from an install utility)"
"\n (U).. UnInstall from LORD (Normally done from an uninstall utility)"
"\n (X).. Exit the IGM (Back to LORD)"
"\n"
"\nYour choice, warrior? "
);
c = toupper( s_in() );
switch( c )
{
case '1':
display( "\n\nBrave soul, enter thy foul words: \n" );
s_gets( temp, 80 );
LORD_FixBadWords( temp );
display( "\n\nI have heard ye.\n%s\n\nPress any key.", temp );
s_in();
break;
case '2':
mess = new LORD_Mail( LORDPlayer.account );
mess->AddText( "`% Message from yourself.." );
mess->AddText( "`0-=-=-=-=-=-=-=-=-=-=-=-=-=-" );
mess->AddText( " The LsDoor SDK provides excellent support for LORD" );
mess->AddText( "including sending mail. Using the LsDoor SDK, you can" );
mess->AddText( "also send charm, experience, skill, and much more" );
mess->AddText( "through LORD's mail." );
mess->AddText( " " );
mess->AddText( "`5 +400 Experience +5000 Gold +1 Charm +3 Skill" );
mess->AddExp( 400 );
mess->AddMoney( 5000 );
mess->AddCharm();
mess->AddSkill( 3 );
delete mess; // This causes the message to be sent. Don't spend more than
// 3 seconds between the 'new' and 'delete' of a message.
// (C++ Rule) Always 'delete' any data created with 'new'.
display("\nThe message is sent. You will not receive the message until");
display("\nyou return to LORD. Press any key.");
s_in();
break;
case 'I':
strcpy( temp, demoExe );
strcat( temp, " /N*" );
LORD_Install( "`$LordDemo", temp );
display("\n@WTis done...Press any key."); s_in();
break;
case 'U':
strcpy( temp, "LordDemo.Exe" );
LORD_UnInstall( temp );
display("\n@WTis done...Press any key."); s_in();
break;
case 'X': display( "\n@WFarewell..." ); exit(0);
}
}
exit( 0 );
}
// End of LordDemo.Cpp